import request from '@/utils/request'
import {ElMessage} from "element-plus";
import type {
    collectionInfo,
    FaceCompareInfo,
    FaceDataInfo,
    FaceSearchInfo,
    SampleInfo
} from '@/types'

export default {
    // 获取集合列表
    getCollectionList: () => {
      return  request({
            url: '/api/visual/collect/list',
            method: 'get',
            params: {
                namespace: 'namespace_1'
            }
        })

    },
    // 获取集合信息
    getCollectionInfo: (namespace: string, collectionName: string) => {
       return  request({
            url: '/api/visual/collect/get',
            method: 'get',
            params: {
                namespace,
                collectionName
            }
        })
    },
    //删除集合
    deleteCollection: (namespace: string, collectionName: string) => {
        return request({
            url: '/api/visual/collect/delete',
            method: 'get',
            params: {
                namespace,
                collectionName
            }
        })
    },
    //创建集合
    addCollection: (collectionInfo: collectionInfo) => {
       return  request({
            url: '/api/visual/collect/create',
            method: 'post',
            data: collectionInfo
        })
    },
    // 创建样本
    addSample: (sampleInfo:SampleInfo ) => {
        return request({
            url: '/api/visual/sample/create',
            method: 'post',
            data: sampleInfo
        })
    },
    // 删除样本
    deleteSample: (namespace: string, collectionName: string, sampleId: string) => {
        return request({
            url: '/api/visual/sample/delete',
            method: 'get',
            params: {
                namespace,
                collectionName,
                sampleId
            }
        })
    },
    // 获取样本
    getSampleInfo: (namespace: string, collectionName: string, sampleId: string) => {
        return request({
            url: '/api/visual/sample/get',
            method: 'get',
            params: {
                namespace,
                collectionName,
                sampleId
            }
        })
    },
    // 获取样本列表
    getSampleList: (namespace: string, collectionName: string, offset: number, limit: number) => {
        return request({
            url: '/api/visual/sample/list',
            method: 'get',
            params: {
                namespace,
                collectionName,
                offset: offset,
                limit: limit,
                order: 'asc'
            }
        })
    },
    // 更新样本
    updateSample: (sampleInfo:SampleInfo ) => {
        return request({
            url: '/api/visual/sample/update',
            method: 'post',
            data: sampleInfo
        })
    },
    // 创建样本人脸数据
    addFaceData: (faceDataInfo:FaceDataInfo) => {
        return request({
            url: '/api/visual/face/create',
            method: 'post',
            data: faceDataInfo
        })
    },
    // 删除样本人脸数据
    deleteFaceData: (namespace: string, collectionName: string, sampleId: string, faceId: string) => {
        return request({
            url: '/api/visual/face/delete',
            method: 'get',
            params: {
                namespace,
                collectionName,
                sampleId,
                faceId
            }
        })
    },
    // 人脸比对
    faceCompare: (faceCompareInfo:FaceCompareInfo) => {
        return request({
            url: '/api/visual/compare/do',
            method: 'post',
            data: faceCompareInfo
        })
    },
    // 人脸检索
    faceSearch: (faceSearchInfo:FaceSearchInfo) => {
        return request({
            url: '/api/visual/search/do',
            method: 'post',
            data: faceSearchInfo
        })
    },


}